<template>
  <div class="ma-content-block lg:flex justify-between p-4">
    <!-- CRUD 组件 -->
    <ma-crud :options="options" :columns="columns" ref="crudRef">
    </ma-crud>
  </div>
</template>
<script setup>
import { ref, reactive } from 'vue'
import customerAudit from '@/api/customers/customerAudit'
import { Message } from '@arco-design/web-vue'
import tool from '@/utils/tool'
import * as common from '@/utils/common'

const crudRef = ref()




const options = reactive({
  id: 'customer_audit',
  pageLayout: 'fixed',
  rowSelection: {
    showCheckedAll: true
  },
  pk: 'id',
  operationColumn: true,
  // operationColumnWidth: 160,
  formOption: {
    viewType: 'drawer',
    width: '70%',
    layout: [
      {
        formType: 'grid-tailwind',
        colNumber: 2,
        cols: [
          {
            formList: [
              {dataIndex: "customer_id"},
              {dataIndex: "company_name"},
              {dataIndex: "contact"},
              {dataIndex: "attachment"},
              {dataIndex: "chinese_phone"},
              {dataIndex: "chinese_city"},
              {dataIndex: "chinese_country"},

              {dataIndex: "english_contact"},
              {dataIndex: "english_address"},

              {dataIndex: "english_state"},
              {dataIndex: "english_zip_code"},
              {dataIndex: "updated_by"},
            ]
          },
          {
            formList: [
              {dataIndex: "type"},
              {dataIndex: "business_license_number"},
              {dataIndex: "contact_phone"},
              {dataIndex: "chinese_contact"},
              {dataIndex: "chinese_address"},
              {dataIndex: "chinese_state"},
              {dataIndex: "chinese_zip_code"},
              {dataIndex: "english_phone"},
              {dataIndex: "english_city"},
              {dataIndex: "english_country"},
              {dataIndex: "created_by"},
              {dataIndex: "created_at"},
              {dataIndex: "updated_at"},
              {dataIndex: "deleted_at"},
              {dataIndex: "remark"},
            ]
          },
        ]
      },
    ]
  },
  api: customerAudit.getList,
  recycleApi: customerAudit.getRecycleList,
  add: {
    show: true,
    api: customerAudit.save,
    auth: ['customers:customerAudit:save']
  },
  edit: {
    show: true,
    api: customerAudit.update,
    auth: ['customers:customerAudit:update']
  },
  delete: {
    show: true,
    api: customerAudit.deletes,
    auth: ['customers:customerAudit:delete'],
    realApi: customerAudit.realDeletes,
    realAuth: ['customers:customerAudit:realDeletes']
  },
  recovery: {
    show: true,
    api: customerAudit.recoverys,
    auth: ['customers:customerAudit:recovery']
  }
})

const columns = reactive([
  {
    title: "主键",
    dataIndex: "id",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    commonRules: {
      required: true,
      message: "请输入主键"
    }
  },
  {
    title: "用户",
    dataIndex: "customer_id",
    formType: "select",
    search: true,
    commonRules: {
      required: true,
      message: "请输入用户"
    }
  },
  {
    title: "用户类型",
    dataIndex: "type",
    formType: "select",
    search: true,
    commonRules: {
      required: true,
      message: "请输入用户类型"
    },
    dict: {
      name: "userType",
      props: {
        label: "title",
        value: "key"
      },
      translation: true
    }
  },
  {
    title: "公司名",
    dataIndex: "company_name",
    formType: "input",
    commonRules: {
      required: true,
      message: "请输入公司名"
    }
  },
  {
    title: "营业执照号码",
    dataIndex: "business_license_number",
    formType: "input",
    search: true,
    commonRules: {
      required: true,
      message: "请输入营业执照号码"
    }
  },
  {
    title: "联系人",
    dataIndex: "contact",
    formType: "input",
    search: true,
    commonRules: {
      required: true,
      message: "请输入联系人"
    }
  },
  {
    title: "联系人电话",
    dataIndex: "contact_phone",
    formType: "input",
    commonRules: {
      required: true,
      message: "请输入联系人电话"
    }
  },
  {
    title: "附件",
    dataIndex: "attachment",
    formType: "input",
    commonRules: {
      required: true,
      message: "请输入附件"
    }
  },
  {
    title: "中文联系人",
    dataIndex: "chinese_contact",
    formType: "input",
    commonRules: {
      required: true,
      message: "请输入中文联系人"
    }
  },
  {
    title: "中文联系人电话",
    dataIndex: "chinese_phone",
    formType: "input",
    search: true
  },
  {
    title: "中文地址",
    dataIndex: "chinese_address",
    formType: "input",
    commonRules: {
      required: true,
      message: "请输入中文地址"
    }
  },
  {
    title: "中文城市",
    dataIndex: "chinese_city",
    formType: "input",
    commonRules: {
      required: true,
      message: "请输入中文城市"
    }
  },
  {
    title: "中文州",
    dataIndex: "chinese_state",
    formType: "input"
  },
  {
    title: "中文国家",
    dataIndex: "chinese_country",
    formType: "input",
    commonRules: {
      required: true,
      message: "请输入中文国家"
    }
  },
  {
    title: "中文邮编",
    dataIndex: "chinese_zip_code",
    formType: "input",
    commonRules: {
      required: true,
      message: "请输入中文邮编"
    }
  },
  {
    title: "英文联系人",
    dataIndex: "english_contact",
    formType: "input",
    commonRules: {
      required: true,
      message: "请输入英文联系人"
    }
  },
  {
    title: "英文联系人电话",
    dataIndex: "english_phone",
    formType: "input"
  },
  {
    title: "英文地址",
    dataIndex: "english_address",
    formType: "input",
    commonRules: {
      required: true,
      message: "请输入英文地址"
    }
  },
  {
    title: "英文城市",
    dataIndex: "english_city",
    formType: "input",
    commonRules: {
      required: true,
      message: "请输入英文城市"
    }
  },
  {
    title: "英文州",
    dataIndex: "english_state",
    formType: "input"
  },
  {
    title: "英文国家",
    dataIndex: "english_country",
    formType: "input",
    commonRules: {
      required: true,
      message: "请输入英文国家"
    }
  },
  {
    title: "英文邮编",
    dataIndex: "english_zip_code",
    formType: "input",
    commonRules: {
      required: true,
      message: "请输入英文邮编"
    }
  },
  {
    title: "创建者",
    dataIndex: "created_by",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "更新者",
    dataIndex: "updated_by",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "创建时间",
    dataIndex: "created_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "更新时间",
    dataIndex: "updated_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "删除时间",
    dataIndex: "deleted_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "备注",
    dataIndex: "remark",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  }
])
</script>
<script> export default { name: 'customers:customerAudit' } </script>